<template>
  <div class="home">
    <data-vue></data-vue>
    <div>
      <button @click="add">+1</button>
      <button @click="reduce">-1</button>
    </div>
    <div>
      <button @click="addTime">在两秒后+1</button>
      <button @click="reduceTime">在两秒后-1</button>
    </div>
  </div>
</template>

<script>
import dataVue from './data.vue'
export default {
  name: 'HomeView',
  components:{
    dataVue
  },
  methods:{
    add(){
      this.$store.commit("addNum");
    },
    reduce(){
      this.$store.commit("reduceNum")
    },
    addTime(){
      this.$store.dispatch("addTimeNum")
    },
    reduceTime(){
      this.$store.dispatch("reduceTimeNum")
    }
  }
}
</script>
